﻿using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace B.MESUI.Login.BasicData_UI
{
    public partial class AddWorkShopForm : DevExpress.XtraEditors.XtraForm
    {
        public string WORKSHOP_CODE => textEdit1.Text.Trim();
        public string WORKSHOP_NAME => textEdit2.Text.Trim();
        public string WORKSHOP_DESCRIPTION => textEdit3.Text.Trim();
        // 添加工作坊表单的构造函数
        public AddWorkShopForm()
        {
          // 初始化组件，为按钮1点击事件添加事件处理程序
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;
            button1.Click += button1_Click;
        }

         // 按钮1点击事件的事件处理方法
         private void button1_Click(object sender, EventArgs e)
        {
             // 检查工作坊代码和名称是否为空
            if (string.IsNullOrEmpty(WORKSHOP_CODE) || string.IsNullOrEmpty(WORKSHOP_NAME))
            {
                 // 如果工作坊代码或名称为空，则显示错误消息并返回
                MessageBox.Show("编号和名称不能为空！");
                return;
            }
             // 设置对话框结果为确定，并关闭表单
            this.DialogResult = DialogResult.OK;

            this.Close();
        }

         // 取消按钮点击事件的事件处理方法
        private void btnCancel_Click(object sender, EventArgs e)
        {
             // 设置对话框结果为取消，并关闭表单
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textEdit1.Text = "";
            textEdit2.Text = "";
            textEdit3.Text = "";
         }
    }
}